<?php 
	class Wangdians extends CI_Model{

		function __construct(){
			parent::__construct();
		}

		function get_wangdian_list($limit = 0, $offset = 0, $condtions = array()){
			$where = '1=1';
			if(!empty($condtions['name'])){
				$where .= " AND name like '%".$condtions['name']."%'";
			}
			$sql = "SELECT SQL_CALC_FOUND_ROWS * FROM {$this->db->dbprefix}o2o_school_wangdians WHERE $where";
			if($limit > 0 || $offset > 0){
				$sql .= " LIMIT $limit, $offset";
			}
			$result = $this->db->query($sql)->result_array();
			if($limit > 0 || $offset > 0){
				$row_num =  $this->db->query('SELECT FOUND_ROWS() as row_num;')->row_array();
				return array("count" => $row_num['row_num'], "result" => $result);
			}else{
				return $result;
			}
		}
	}